package org.fast.easy.messages.feign.service;

import jakarta.validation.constraints.NotBlank;
import org.fast.easy.core.domain.result.R;

import org.fast.easy.core.domain.messages.MessagePublishDomain;
import org.fast.easy.messages.feign.factory.MessagesFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static org.fast.easy.messages.feign.constant.MessagesServiceNameConstants.*;

/**
 * 类说明
 *
 * @author YanMing
 * @date 2024/5/15
 */
@FeignClient(contextId = MESSAGES_FEIGN_SERVICE_CONTEXT_ID, value = MESSAGES_FEIGN_SERVICE_NAME, fallbackFactory = MessagesFeignFallbackFactory.class)
public interface MessagesFeignService {

    @PostMapping(MESSAGE_SERVICE_MAPPING+"/publishAll")
    public R<Void> publishAll(MessagePublishDomain message);


    @GetMapping(EMAIL_SERVICE_MAPPING+"/code")
    public R<Void> emailCode(@RequestParam("email") String email);

    @GetMapping(SMS_SERVICE_MAPPING+"/code")
    public R<Void> smsCode(@RequestParam("phonenumber") String phonenumber);


}
